// Package data_binding
// desc: x
// author: Locker
// date: 2024/6/10
// version: 1.0.0
package main

import (
	"fyne.io/fyne/v2/app"
	"fyne.io/fyne/v2/data/binding"
	"fyne.io/fyne/v2/widget"
	"time"
)

func main() {
	a := app.New()
	w := a.NewWindow("data binding")

	str := binding.NewString()
	go func() {
		dots := "....."
		for i := 5; i >= 0; i-- {
			str.Set("Count down " + dots[:i])
			time.Sleep(time.Second)
		}
		str.Set("Blast off!")
		w.Hide()
		a.Quit()
	}()

	w.SetContent(widget.NewLabelWithData(str))
	w.ShowAndRun()
}
